package org.dinner.order.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@NamedQueries({
	@NamedQuery(name = "ItemDish.list", query = "from ItemDish") //TODO implement paging mechanism
})
@Table(name = "ITEM_DISHES")
public class ItemDish {
	@Id
	@GeneratedValue
	private int id;
	@ManyToOne
	@JoinColumn(name="dish_id", nullable=false)
	private Dish dish;
	
	private int count;
	@ManyToOne
	@JoinColumn(name = "item_id")
	private OrderItem item;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Dish getDish() {
		return dish;
	}

	public void setDish(Dish dish) {
		this.dish = dish;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public OrderItem getItem() {
		return item;
	}

	public void setItem(OrderItem item) {
		this.item = item;
	}
	

}
